import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:shop/shop/life/Cart.dart';
import 'package:shop/shop/life/FenleiPage.dart';
import 'package:shop/shop/life/HomePage.dart';
import 'package:shop/shop/life/MerchantListPage.dart';
import 'package:shop/shop/life/ServiceHomePage.dart';
import 'package:shop/shop/life/ServiceIndexPage.dart';

import 'Center.dart';
class Index extends StatefulWidget {
  Index({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _Index createState() => _Index();
}
class _Index extends State<Index>  with SingleTickerProviderStateMixin {
  TabController controller;

  @override
  void initState() {
    controller = new TabController(length: 4, vsync: this);
  }

  @override
  void dispose() {
    controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        body: new TabBarView(
          controller: controller,
          children: <Widget>[
            new HomePage(),
            // new FenleiPage(),
            ServiceHomePage(),
            new Cart(),
            new MyCenter(),
          ],
        ),
        bottomNavigationBar: new Material(
          color: Colors.white,
          child: new TabBar(
            controller: controller,
            labelColor: Colors.lightBlue,
            unselectedLabelColor: Colors.black26,
            tabs: <Widget>[
              new Tab(
                text: "外卖",
                icon: new Icon(Icons.home),
              ),
              new Tab(
                text: "服务",
                icon: new Icon(Icons.list),
              ),
              new Tab(
                text: "购物车",
                icon: new Icon(Icons.shopping_cart),
              ),
              new Tab(
                text: "个人中心",
                icon: new Icon(Icons.near_me),
              ),
            ],
          ),
        ),
      ),
    );
  }

}